public interface Observer {
    void update(String message, String status);
}

public class ConcreteObserver implements Observer {

    private final String observerName;

    public ConcreteObserver(final String observerName) {
        this.observerName = observerName;
    }

    @Override
    public void update(final String message, final String status) {
        System.out.println(observerName + " 收到更新 - 消息：" + message + " 状态：" + status);
    }
}
public class Thief extends Observable {

    private String name;

    public Thief(final String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(final String name) {
        this.name = name;
    }

    public void steal() {
        System.out.println("小偷" + this.getName() + ": 我偷了隔壁的珍珠奶茶，有没有人来抓我。");
        setChanged();
        notifyObservers(this.getName());
    }
}
public static void main(String[] args){
    
    // 创建一个小偷偷东西
    Thief thief = new Thief("张三");

    // 添加几个不同的观察者去监视小偷的行为
    Observer policeStation = new ConcreteObserver("警察局");
    Observer neighbor = new ConcreteObserver("邻居李四");

    // 注册这些观察者以接收来自thief的通知
    thief.addObserver(policeStation);
    thief.addObserver(neighbor);

    // 让小偷开始行动触发事件
    thief.steal();

}
